 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.





Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKRedis/RedisModel.h>

@implementation Backup
-(id) initWithBaseId:(NSString*) baseId
      backupFileName:(NSString*)backupFileName
      cacheInstanceId:(NSString*)cacheInstanceId
      backupStartTime:(NSString*)backupStartTime
      backupEndTime:(NSString*)backupEndTime
      backupType:(NSNumber*)backupType
      backupSize:(NSNumber*)backupSize
      backupStatus:(NSNumber*)backupStatus
      backupDownloadURL:(NSString*)backupDownloadURL { 
     self.baseId = baseId;               
     self.backupFileName = backupFileName;               
     self.cacheInstanceId = cacheInstanceId;               
     self.backupStartTime = backupStartTime;               
     self.backupEndTime = backupEndTime;               
     self.backupType = backupType;               
     self.backupSize = backupSize;               
     self.backupStatus = backupStatus;               
     self.backupDownloadURL = backupDownloadURL;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self baseId])
    {
        [result setValue:[self baseId] forKey:@"baseId"];
    }
    if([self backupFileName])
    {
        [result setValue:[self backupFileName] forKey:@"backupFileName"];
    }
    if([self cacheInstanceId])
    {
        [result setValue:[self cacheInstanceId] forKey:@"cacheInstanceId"];
    }
    if([self backupStartTime])
    {
        [result setValue:[self backupStartTime] forKey:@"backupStartTime"];
    }
    if([self backupEndTime])
    {
        [result setValue:[self backupEndTime] forKey:@"backupEndTime"];
    }
    if([self backupType])
    {
        [result setValue:[self backupType] forKey:@"backupType"];
    }
    if([self backupSize])
    {
        [result setValue:[self backupSize] forKey:@"backupSize"];
    }
    if([self backupStatus])
    {
        [result setValue:[self backupStatus] forKey:@"backupStatus"];
    }
    if([self backupDownloadURL])
    {
        [result setValue:[self backupDownloadURL] forKey:@"backupDownloadURL"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.baseId = [dictionary objectForKey:@"baseId"];
    self.backupFileName = [dictionary objectForKey:@"backupFileName"];
    self.cacheInstanceId = [dictionary objectForKey:@"cacheInstanceId"];
    self.backupStartTime = [dictionary objectForKey:@"backupStartTime"];
    self.backupEndTime = [dictionary objectForKey:@"backupEndTime"];
    self.backupType = [dictionary objectForKey:@"backupType"];
    self.backupSize = [dictionary objectForKey:@"backupSize"];
    self.backupStatus = [dictionary objectForKey:@"backupStatus"];
    self.backupDownloadURL = [dictionary objectForKey:@"backupDownloadURL"];
    return self;
}
 @end
@implementation DownloadUrl
-(id) initWithName:(NSString*) name
      link:(NSString*)link { 
     self.name = name;               
     self.link = link;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self name])
    {
        [result setValue:[self name] forKey:@"name"];
    }
    if([self link])
    {
        [result setValue:[self link] forKey:@"link"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.name = [dictionary objectForKey:@"name"];
    self.link = [dictionary objectForKey:@"link"];
    return self;
}
 @end
@implementation ConfigItem
-(id) initWithConfigName:(NSString*) configName
      configValue:(NSString*)configValue { 
     self.configName = configName;               
     self.configValue = configValue;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self configName])
    {
        [result setValue:[self configName] forKey:@"configName"];
    }
    if([self configValue])
    {
        [result setValue:[self configValue] forKey:@"configValue"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.configName = [dictionary objectForKey:@"configName"];
    self.configValue = [dictionary objectForKey:@"configValue"];
    return self;
}
 @end
@implementation Tag
-(id) initWithKey:(NSString*) key
      value:(NSString*)value { 
     self.key = key;               
     self.value = value;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self key])
    {
        [result setValue:[self key] forKey:@"key"];
    }
    if([self value])
    {
        [result setValue:[self value] forKey:@"value"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.key = [dictionary objectForKey:@"key"];
    self.value = [dictionary objectForKey:@"value"];
    return self;
}
 @end
@implementation AzId
-(id) initWithMaster:(NSString*) master
      slave:(NSString*)slave { 
     self.master = master;               
     self.slave = slave;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self master])
    {
        [result setValue:[self master] forKey:@"master"];
    }
    if([self slave])
    {
        [result setValue:[self slave] forKey:@"slave"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.master = [dictionary objectForKey:@"master"];
    self.slave = [dictionary objectForKey:@"slave"];
    return self;
}
 @end
@implementation AzIdSpec
-(id) initWithMaster:(NSString*) master
      slave:(NSString*)slave { 
     self.master = master;               
     self.slave = slave;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self master])
    {
        [result setValue:[self master] forKey:@"master"];
    }
    if([self slave])
    {
        [result setValue:[self slave] forKey:@"slave"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.master = [dictionary objectForKey:@"master"];
    self.slave = [dictionary objectForKey:@"slave"];
    return self;
}
 @end
@implementation InstanceClass
-(id) initWithInstanceClassValue:(NSString*) instanceClassValue
      instanceType:(NSString*)instanceType
      cpu:(NSNumber*)cpu
      memoryMB:(NSNumber*)memoryMB
      diskGB:(NSNumber*)diskGB
      maxConnection:(NSNumber*)maxConnection
      bandwidthMbps:(NSNumber*)bandwidthMbps { 
     self.instanceClassValue = instanceClassValue;               
     self.instanceType = instanceType;               
     self.cpu = cpu;               
     self.memoryMB = memoryMB;               
     self.diskGB = diskGB;               
     self.maxConnection = maxConnection;               
     self.bandwidthMbps = bandwidthMbps;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self instanceClassValue])
    {
        [result setValue:[self instanceClassValue] forKey:@"instanceClass"];
    }
    if([self instanceType])
    {
        [result setValue:[self instanceType] forKey:@"instanceType"];
    }
    if([self cpu])
    {
        [result setValue:[self cpu] forKey:@"cpu"];
    }
    if([self memoryMB])
    {
        [result setValue:[self memoryMB] forKey:@"memoryMB"];
    }
    if([self diskGB])
    {
        [result setValue:[self diskGB] forKey:@"diskGB"];
    }
    if([self maxConnection])
    {
        [result setValue:[self maxConnection] forKey:@"maxConnection"];
    }
    if([self bandwidthMbps])
    {
        [result setValue:[self bandwidthMbps] forKey:@"bandwidthMbps"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceClassValue = [dictionary objectForKey:@"instanceClass"];
    self.instanceType = [dictionary objectForKey:@"instanceType"];
    self.cpu = [dictionary objectForKey:@"cpu"];
    self.memoryMB = [dictionary objectForKey:@"memoryMB"];
    self.diskGB = [dictionary objectForKey:@"diskGB"];
    self.maxConnection = [dictionary objectForKey:@"maxConnection"];
    self.bandwidthMbps = [dictionary objectForKey:@"bandwidthMbps"];
    return self;
}
 @end
@implementation OrderStatus
-(id) initWithTotal:(NSNumber*) total
      success:(NSNumber*)success
      fail:(NSNumber*)fail
      inProcess:(NSNumber*)inProcess
      resourceIds:(NSArray<NSString*>*)resourceIds { 
     self.total = total;               
     self.success = success;               
     self.fail = fail;               
     self.inProcess = inProcess;               
     self.resourceIds = resourceIds;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self total])
    {
        [result setValue:[self total] forKey:@"total"];
    }
    if([self success])
    {
        [result setValue:[self success] forKey:@"success"];
    }
    if([self fail])
    {
        [result setValue:[self fail] forKey:@"fail"];
    }
    if([self inProcess])
    {
        [result setValue:[self inProcess] forKey:@"inProcess"];
    }
    if([self resourceIds])
    {
        [result setValue:[self resourceIds] forKey:@"resourceIds"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.total = [dictionary objectForKey:@"total"];
    self.success = [dictionary objectForKey:@"success"];
    self.fail = [dictionary objectForKey:@"fail"];
    self.inProcess = [dictionary objectForKey:@"inProcess"];
    self.resourceIds = [dictionary objectForKey:@"resourceIds"];
    return self;
}
 @end
@implementation InstanceName
-(id) initWithResourceId:(NSString*) resourceId
      resourceName:(NSString*)resourceName
      serviceCode:(NSString*)serviceCode { 
     self.resourceId = resourceId;               
     self.resourceName = resourceName;               
     self.serviceCode = serviceCode;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self resourceId])
    {
        [result setValue:[self resourceId] forKey:@"resourceId"];
    }
    if([self resourceName])
    {
        [result setValue:[self resourceName] forKey:@"resourceName"];
    }
    if([self serviceCode])
    {
        [result setValue:[self serviceCode] forKey:@"serviceCode"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.resourceId = [dictionary objectForKey:@"resourceId"];
    self.resourceName = [dictionary objectForKey:@"resourceName"];
    self.serviceCode = [dictionary objectForKey:@"serviceCode"];
    return self;
}
 @end
@implementation SlowLog
-(id) initWithCommand:(NSString*) command
      startTime:(NSString*)startTime
      executionTime:(NSString*)executionTime
      shardId:(NSString*)shardId { 
     self.command = command;               
     self.startTime = startTime;               
     self.executionTime = executionTime;               
     self.shardId = shardId;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self command])
    {
        [result setValue:[self command] forKey:@"command"];
    }
    if([self startTime])
    {
        [result setValue:[self startTime] forKey:@"startTime"];
    }
    if([self executionTime])
    {
        [result setValue:[self executionTime] forKey:@"executionTime"];
    }
    if([self shardId])
    {
        [result setValue:[self shardId] forKey:@"shardId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.command = [dictionary objectForKey:@"command"];
    self.startTime = [dictionary objectForKey:@"startTime"];
    self.executionTime = [dictionary objectForKey:@"executionTime"];
    self.shardId = [dictionary objectForKey:@"shardId"];
    return self;
}
 @end
@implementation Shard
-(id) initWithId:(NSString*) idValue { 
     self.idValue = idValue;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self idValue])
    {
        [result setValue:[self idValue] forKey:@"id"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.idValue = [dictionary objectForKey:@"id"];
    return self;
}
 @end
@implementation Proxy
-(id) initWithId:(NSString*) idValue { 
     self.idValue = idValue;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self idValue])
    {
        [result setValue:[self idValue] forKey:@"id"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.idValue = [dictionary objectForKey:@"id"];
    return self;
}
 @end
@implementation CacheInstance
-(id) initWithCacheInstanceId:(NSString*) cacheInstanceId
      cacheInstanceName:(NSString*)cacheInstanceName
      cacheInstanceClass:(NSString*)cacheInstanceClass
      cacheInstanceMemoryMB:(NSNumber*)cacheInstanceMemoryMB
      cacheInstanceStatus:(NSString*)cacheInstanceStatus
      cacheInstanceDescription:(NSString*)cacheInstanceDescription
      createTime:(NSString*)createTime
      azId:(AzId*)azId
      vpcId:(NSString*)vpcId
      subnetId:(NSString*)subnetId
      connectionDomain:(NSString*)connectionDomain
      port:(NSNumber*)port
      charge:(Charge*)charge
      instanceVersion:(NSString*)instanceVersion
      auth:(NSNumber*)auth
      redisVersion:(NSString*)redisVersion
      cacheInstanceType:(NSString*)cacheInstanceType
      ipv6On:(NSNumber*)ipv6On
      tags:(NSArray<Tag*>*)tags { 
     self.cacheInstanceId = cacheInstanceId;               
     self.cacheInstanceName = cacheInstanceName;               
     self.cacheInstanceClass = cacheInstanceClass;               
     self.cacheInstanceMemoryMB = cacheInstanceMemoryMB;               
     self.cacheInstanceStatus = cacheInstanceStatus;               
     self.cacheInstanceDescription = cacheInstanceDescription;               
     self.createTime = createTime;               
     self.azId = azId;               
     self.vpcId = vpcId;               
     self.subnetId = subnetId;               
     self.connectionDomain = connectionDomain;               
     self.port = port;               
     self.charge = charge;               
     self.instanceVersion = instanceVersion;               
     self.auth = auth;               
     self.redisVersion = redisVersion;               
     self.cacheInstanceType = cacheInstanceType;               
     self.ipv6On = ipv6On;               
     self.tags = tags;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self cacheInstanceId])
    {
        [result setValue:[self cacheInstanceId] forKey:@"cacheInstanceId"];
    }
    if([self cacheInstanceName])
    {
        [result setValue:[self cacheInstanceName] forKey:@"cacheInstanceName"];
    }
    if([self cacheInstanceClass])
    {
        [result setValue:[self cacheInstanceClass] forKey:@"cacheInstanceClass"];
    }
    if([self cacheInstanceMemoryMB])
    {
        [result setValue:[self cacheInstanceMemoryMB] forKey:@"cacheInstanceMemoryMB"];
    }
    if([self cacheInstanceStatus])
    {
        [result setValue:[self cacheInstanceStatus] forKey:@"cacheInstanceStatus"];
    }
    if([self cacheInstanceDescription])
    {
        [result setValue:[self cacheInstanceDescription] forKey:@"cacheInstanceDescription"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self azId])
    {
        [result setValue:[[self azId] dictionary]forKey:@"azId"];
    }
    if([self vpcId])
    {
        [result setValue:[self vpcId] forKey:@"vpcId"];
    }
    if([self subnetId])
    {
        [result setValue:[self subnetId] forKey:@"subnetId"];
    }
    if([self connectionDomain])
    {
        [result setValue:[self connectionDomain] forKey:@"connectionDomain"];
    }
    if([self port])
    {
        [result setValue:[self port] forKey:@"port"];
    }
    if([self charge])
    {
        [result setValue:[[self charge] dictionary]forKey:@"charge"];
    }
    if([self instanceVersion])
    {
        [result setValue:[self instanceVersion] forKey:@"instanceVersion"];
    }
    if([self auth])
    {
        [result setValue:[self auth] forKey:@"auth"];
    }
    if([self redisVersion])
    {
        [result setValue:[self redisVersion] forKey:@"redisVersion"];
    }
    if([self cacheInstanceType])
    {
        [result setValue:[self cacheInstanceType] forKey:@"cacheInstanceType"];
    }
    if([self ipv6On])
    {
        [result setValue:[self ipv6On] forKey:@"ipv6On"];
    }
    if([self tags])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self tags] count]; i++) {
            Tag* item = [[self tags] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"tags"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.cacheInstanceId = [dictionary objectForKey:@"cacheInstanceId"];
    self.cacheInstanceName = [dictionary objectForKey:@"cacheInstanceName"];
    self.cacheInstanceClass = [dictionary objectForKey:@"cacheInstanceClass"];
    self.cacheInstanceMemoryMB = [dictionary objectForKey:@"cacheInstanceMemoryMB"];
    self.cacheInstanceStatus = [dictionary objectForKey:@"cacheInstanceStatus"];
    self.cacheInstanceDescription = [dictionary objectForKey:@"cacheInstanceDescription"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    self.azId = [[AzId alloc]initWithDic:[dictionary objectForKey:@"azId"]];
    self.vpcId = [dictionary objectForKey:@"vpcId"];
    self.subnetId = [dictionary objectForKey:@"subnetId"];
    self.connectionDomain = [dictionary objectForKey:@"connectionDomain"];
    self.port = [dictionary objectForKey:@"port"];
    self.charge = [[Charge alloc]initWithDic:[dictionary objectForKey:@"charge"]];
    self.instanceVersion = [dictionary objectForKey:@"instanceVersion"];
    self.auth = [dictionary objectForKey:@"auth"];
    self.redisVersion = [dictionary objectForKey:@"redisVersion"];
    self.cacheInstanceType = [dictionary objectForKey:@"cacheInstanceType"];
    self.ipv6On = [dictionary objectForKey:@"ipv6On"];
    NSArray* tagsArray = [dictionary objectForKey:@"tags"];
    if(tagsArray&&![tagsArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [tagsArray count];i++)
        {
            Tag* item = [[Tag alloc]initWithDic:[tagsArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.tags = propertyArray;
    }
    return self;
}
 @end
@implementation CacheInstanceSpec
-(id) initWithVpcId:(NSString*) vpcId
      subnetId:(NSString*)subnetId
      cacheInstanceName:(NSString*)cacheInstanceName
      cacheInstanceClass:(NSString*)cacheInstanceClass
      password:(NSString*)password
      azId:(AzIdSpec*)azId
      cacheInstanceDescription:(NSString*)cacheInstanceDescription
      redisVersion:(NSString*)redisVersion
      ipv6On:(NSNumber*)ipv6On { 
     self.vpcId = vpcId;               
     self.subnetId = subnetId;               
     self.cacheInstanceName = cacheInstanceName;               
     self.cacheInstanceClass = cacheInstanceClass;               
     self.password = password;               
     self.azId = azId;               
     self.cacheInstanceDescription = cacheInstanceDescription;               
     self.redisVersion = redisVersion;               
     self.ipv6On = ipv6On;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self vpcId])
    {
        [result setValue:[self vpcId] forKey:@"vpcId"];
    }
    if([self subnetId])
    {
        [result setValue:[self subnetId] forKey:@"subnetId"];
    }
    if([self cacheInstanceName])
    {
        [result setValue:[self cacheInstanceName] forKey:@"cacheInstanceName"];
    }
    if([self cacheInstanceClass])
    {
        [result setValue:[self cacheInstanceClass] forKey:@"cacheInstanceClass"];
    }
    if([self password])
    {
        [result setValue:[self password] forKey:@"password"];
    }
    if([self azId])
    {
        [result setValue:[[self azId] dictionary]forKey:@"azId"];
    }
    if([self cacheInstanceDescription])
    {
        [result setValue:[self cacheInstanceDescription] forKey:@"cacheInstanceDescription"];
    }
    if([self redisVersion])
    {
        [result setValue:[self redisVersion] forKey:@"redisVersion"];
    }
    if([self ipv6On])
    {
        [result setValue:[self ipv6On] forKey:@"ipv6On"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.vpcId = [dictionary objectForKey:@"vpcId"];
    self.subnetId = [dictionary objectForKey:@"subnetId"];
    self.cacheInstanceName = [dictionary objectForKey:@"cacheInstanceName"];
    self.cacheInstanceClass = [dictionary objectForKey:@"cacheInstanceClass"];
    self.password = [dictionary objectForKey:@"password"];
    self.azId = [[AzIdSpec alloc]initWithDic:[dictionary objectForKey:@"azId"]];
    self.cacheInstanceDescription = [dictionary objectForKey:@"cacheInstanceDescription"];
    self.redisVersion = [dictionary objectForKey:@"redisVersion"];
    self.ipv6On = [dictionary objectForKey:@"ipv6On"];
    return self;
}
 @end
@implementation ClusterInfo
-(id) initWithProxies:(Proxy*) proxies
      shards:(Shard*)shards { 
     self.proxies = proxies;               
     self.shards = shards;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self proxies])
    {
        [result setValue:[[self proxies] dictionary]forKey:@"proxies"];
    }
    if([self shards])
    {
        [result setValue:[[self shards] dictionary]forKey:@"shards"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.proxies = [[Proxy alloc]initWithDic:[dictionary objectForKey:@"proxies"]];
    self.shards = [[Shard alloc]initWithDic:[dictionary objectForKey:@"shards"]];
    return self;
}
 @end
 
 


